/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, { Component } from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    View
} from 'react-native';
import IndexCompoent from './IndexCompoent'
import ExportVabrias,{name,age,sum} from "./ExportVabrias"
import ReceiveCompoent from "./ReceiveCompoent"
import LifecycleComponent from './LifecycleComponent'
export default class setup extends Component {
    constructor(props){
        super(props);
        this.state={
            remove:false
        }
    }
    render() {
        var view = this.state.remove?null:<LifecycleComponent/>;
        var text = this.state.remove?"让他复活":"干掉";
        var params = {namep : "Geguo",agep:12};
        return (
            <View style={styles.container}>
            {/*<IndexCompoent/>*/}


            <Text style={{fontSize:20,backgroundColor:'#420'}}
                  onPress={()=>{
                    this.setState({
                        remove:!this.state.remove,
                    })
                }}
            >{text}</Text>

                {view}

                <Text>名字：{name}</Text>
                <Text>年龄：{age}</Text>
                <Text>函数：{sum(2,4)}</Text>


                <ReceiveCompoent
                    {/*namep="geguo"
                    agep="25"*/}
                    {...params}
                />

            </View>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#F5FCFF',
        marginTop:40
    },
    welcome: {
        fontSize: 20,
        textAlign: 'center',
        margin: 10,
    },
    instructions: {
        textAlign: 'center',
        color: '#333333',
        marginBottom: 5,
    },
});
/**
 * 注册一个根组件
 * */
AppRegistry.registerComponent('imooc_sample', () => imooc_sample);
